
export function formatTip(status, parameters) {
    const locale = window.localStorage.getItem('umi_locale') || 'zh-CN';
    const tipO = window.tipConfig ? window.tipConfig[`${status}`] || {} : {};
    return formatCheckErr(tipO[locale], parameters) || '';
}

export const formatCheckErr = function (errMsg, paramObj) {
    let reMsg = errMsg;

    if ('string' === typeof reMsg && paramObj) {

        for (const k in paramObj) {

            if (paramObj.hasOwnProperty(k)) {
                const val = paramObj[k];
                reMsg = reMsg.replace(eval(`/\{${k}\}/g`), val);
            }
        }
    }
    return reMsg;
};